const nums = [1,3,5,6]
const target = 7


var searchInsert = function(nums, target) {
    if (nums.length===0)return""
    const len=nums.length
    for(let i=0;i<len;i++)
    {
        if(nums[i]===target)
        {
            return i
        }
        if(nums[i]>=target)
        {
            return i
        }
    }
    return len
}(nums, target)
console.log(searchInsert)